package com.iexbuy.ihg.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;

import com.iexbuy.ihg.R;
import com.iexbuy.ihg.common.CommUtil;
import com.iexbuy.ihg.entity.Shop;
import com.iexbuy.ihg.entity.YunItemListObject;
import com.jingchen.pulltorefresh.PullToRefreshLayout;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;

public class ShopImageDescFragment extends BaseFragment {
	
	private static ShopImageDescFragment homeFragmentInstent;

	@ViewInject(R.id.msgListLayout)
	private PullToRefreshLayout msgListRefreshLayout;
	@ViewInject(R.id.webview)
	private WebView webview;

	private static YunItemListObject yunItemListObject;
	private static Shop shop;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		homeFragmentInstent = this;
	}

	@Override
	protected View _onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_yunguo_desc, container, false);
		ViewUtils.inject(this, rootView);
		initView(rootView);
		return rootView;
	}

	private void initView(View rootView) {
		mBaseActivity.setTitle(getResources().getString(R.string.yun_guo_image_detail));
		mBaseActivity.setTitleLayoutVisibility(true);
		mBaseActivity.setHomeActivity(false);

		getWebViewData();
	}

	private void getWebViewData() {
		if (shop == null) return;

		CommUtil.loadWebviewData(webview, shop.getFullTxt());
	}

	public static void setFullTxt(Shop shop) {
		ShopImageDescFragment.shop = shop;
	}

	/**
	 * @return the homeFragmentInstent
	 */
	public static ShopImageDescFragment getHomeFragmentInstent() {
		return homeFragmentInstent;
	}

}
